﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Globalization;
using TimKen.BussLogic;

namespace TimKen.Web
{
    public partial class Top : TimKen.App.BaseUserControl
    {
      

        protected void Page_Load(object sender, EventArgs e)
        {       
        }
        private void SetLanguage(string language)
        {
            HttpCookie cookie = new HttpCookie("Language");
            DateTime dt = DateTime.Now;//定义时间对象
            TimeSpan ts = new TimeSpan(0, 20, 0);
            cookie.Expires.Add(ts);
            cookie.Value = language;
            HttpContext.Current.Response.AppendCookie(cookie);
            CultureInfo culture = new CultureInfo(language);
            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;
            Server.Transfer(Request.Path);
        }

        protected void btnChinese_Click(object sender, EventArgs e)
        {
            SetLanguage("zh-CN");
        }

        protected void btnEnglish_Click(object sender, EventArgs e)
        {
            SetLanguage("en-US");
        }    
    }
}